Repository navigation
SDK 0.5.0: events.track, trackBatch and catalog (ZAL-17) - #3
Merged
Merged
Conversation
Records a workspace's own events for automations (ZAL-17) through POST /events, POST /events/batch and GET /events/catalog. - every track/trackBatch call sends an Idempotency-Key (a fresh UUID unless given); the API uses it as the dedupe key for events without a uniqueId, so the SDK's own retries never record twice - time accepts a Date (sent as ISO 8601) - ZalifyError gains field for event errors; new codes invalid_event, reserved_event, undeclared_event, payload_too_large (not retried), daily_limit - README: Events section, error table rows Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…y key Review follow-ups: - no auto Idempotency-Key: it replaced the API's content dedupe, so re-running a history import without uniqueIds recorded everything again. time is now fixed client-side before the first attempt, so a retry resends an identical body and the content hash dedupes it; a caller's key passes through unchanged - JSDoc + README: a caller key must be new per call (<key>:<index> collides across batches); duplicate means already recorded, possibly by an earlier attempt of the same call - invalid Date and over-long keys (255, 251 on a batch) fail as ZalifyError before any request - tests: batch retry resends the same body, daily_limit not retried, client-side validation - CI runs contacts and events tests too Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the Events API client for ZAL-17. The public endpoints are live in the app (app#2371):
POST /api/v1/events,POST /api/v1/events/batch,GET /api/v1/events/catalog.zalify.events.track(input, { idempotencyKey? }),zalify.events.trackBatch(inputs, …)(≤ 100, per-event results),zalify.events.catalog().Idempotency-Key(fresh UUID unless given). The API uses it as the dedupe key for events without auniqueId(<key>:<index>on a batch), so the SDK's built-in retries on 429/503/timeouts never record an event twice. A test checks the retry reuses the key.timeacceptsDate | string; Dates are sent as ISO 8601.ZalifyErrorgainsfield(from the API'sdetails.fieldon event errors). New codes:invalid_event,reserved_event,undeclared_event,payload_too_large(413, not retried),daily_limit.VERSION.Tests: 22 pass (7 new in
test/events.test.ts);tsc --noEmitclean; tsup build OK.Merging publishes:
publish.ymlon main publishes@zalify/sdkwhen package.json changes and the version isn't on npm yet, so merging this releases 0.5.0. (The localci/auto-publishbranch is not on main, but main already has a version-driven publish workflow.)🤖 Generated with Claude Code